class Solution {
public:
    bool isUgly(int n) {
        if (n <= 0)
            return false;
        vector<int> arr = {2, 3, 5};
        for (auto& e : arr)
        {
            while (n % e == 0)
            {
                n /= e;
            }
        }
        return n == 1;
    }
};